package saling_ticket.service;


public class SellingTicket implements  Runnable{

    private  int  ticket=10;
    @Override
    public void run() {
        while(true) {

            if (ticket > 0) {
                try {
                    Thread.sleep(10);

                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println(Thread.currentThread().getName() + "卖出了第" + ticket-- + "张票");//
            } else {
                break;
            }
        }
    }
}
